package com.itheima.edu.info.manager.service;

import com.itheima.edu.info.manager.dao.Dao;
import com.itheima.edu.info.manager.domain.Person;

import static com.itheima.edu.info.manager.entry.infoEntry.DAO;

public class Service {
   public String flag2;

    public Service() {


    }




    public boolean findPerson(String id) {
        Person[] stu =DAO.findPerson();
        for (int i = 0; i < stu.length; i++) {
            Person stu1 = stu[i];
            if (stu1!=null&&stu1.getId().equals(id)){
                return true;
            }
        }
        return false;
    }

    public Person[] findAllPerson() {
        //System.out.println(flag2);
        return DAO.findPerson();

    }

    public void addPerson(Person person) {
        DAO.addPerson(person);
    }

    public void deletePerson(String id) {
        DAO.deletePerson(id);
    }

    public void updataPerson(String id, Person person) {
        DAO.updataPerson(id,person);
    }
}
